package com.job.ZhangMeng.Homework0711;

import java.util.Scanner;

public class TestHash {

    public static void main(String[] args) {
        //final Legend h=new TopRoad();
        //h.name="小黑";
            //获取h的运行时类
            //System.out.println(h.getClass().getName());
        Scanner ch2=new Scanner(System.in);
        Scanner ch1=new Scanner(System.in);
        System.out.println(ch1.getClass().getName());

        President p1=President.getInstance();
        President p2=President.getInstance();

        //哈希值根据地址来计算
        System.out.println(p1.hashCode());
        System.out.println(p2.hashCode());

        System.out.println(ch1.hashCode());
        System.out.println(ch2.hashCode());

        //打印引用类型时,默认调用toString()方法
        System.out.println(p1);
        System.out.println(p1.toString());

    }

}
